import request from '@/hooks/request'

const Api = {
  getQuotationRuleList: '/platform/quotationRule/getQuotationRuleList', // 报价规则
  addQuotationRule: '/platform/quotationRule/addQuotationRule', // 新增
  deleteQuotationRule: '/platform/quotationRule/deleteQuotationRule', // 删
  getCinemaLineList: '/platform/quotationRule/getCinemaLineList', // 院线列表
  getFilmList: '/platform/quotationRule/getFilmList', // 影片列表
  editQuotationRule: '/platform/quotationRule/editQuotationRule', // 改
  getProvinceList: '/platform/quotationRule/getProvinceList', // 省份列表
  getCityList: '/platform/quotationRule/getCityList', // 城市列表
  ruleState: '/platform/quotationRule/editRuleStatus',//报价规则按钮修改接口
  quotationRulePushArriveRobots: '/platform/quotationRule/quotationRulePushArriveRobots', // 推送报价规则到多个机器人
  getQuotationRuleByCode: '/platform/quotationRule/getQuotationRuleByCode', // 根据邀请码或规则码获取报价规则
}

export const getQuotationRuleList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getQuotationRuleList,
    data: parameter,
  })
}

export const addQuotationRule = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.addQuotationRule,
    data: parameter,
  })
}

export const deleteQuotationRule = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('id', parameter.id)
  return request({
    method: 'post',
    url: Api.deleteQuotationRule,
    data: formData,
  })
}

export const getCinemaLineList = () => {
  return request({
    method: 'post',
    url: Api.getCinemaLineList,
  })
}

export const getFilmList = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('filmName', parameter.fileName)
  return request({
    method: 'post',
    url: Api.getFilmList,
    data: formData,
  })
}

export const editQuotationRule = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.editQuotationRule,
    data: parameter,
  })
}

export const getProvinceList = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('onOff', parameter.onOff)
  return request({
    method: 'post',
    url: Api.getProvinceList,
    data: formData
  })
}

export const getCityList = () => {
  return request({
    method: 'post',
    url: Api.getCityList,
  })
}
export const EditRuleState = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.ruleState,
    data: parameter,
  })
}

export const quotationRulePushArriveRobots = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.quotationRulePushArriveRobots,
    data: parameter,
  })
}



export const getQuotationRuleByCode = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getQuotationRuleByCode,
    data: parameter,
  })
}

